<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>定时跳转</title>
    <style>
        body{
            background-color: #F3EFE0;
        }
        div{
            width: 600px;
            margin: 50px auto;
        }
        a{
            position: relative;
            right: 250px;
            float: right;
            font-size: large;
            text-decoration: none;
        }
        .bot{
            color: #918E84;
            font-family:Arial, Helvetica, sans-serif;
            font-size: 24px;
            position: relative;
            right: 200px;
            float: right;
        }
    </style>
</head>
<body>
    <div>
        <h2>提交成功</h2>
        <a href="../章节目录/第六章.html">
            <span id="seconds" style="font-size: 22px;">3</span>秒后系统会自动跳转,也可单击此链接跳转
        </a>
    </div>
    <br><br><br>
    <a href="../章节目录/第六章.html">返回上一页</a>
    <div class="bot">
        <br><br><br><br><br><br><br><br>
        <h3>Please appreciate((●'◡'●))......</h3>
    </div>
    <script>
        //定义timing判断是否进行页面的跳转
        function timing(secs, url){
            //获取页面元素对象
            var seconds = document.getElementById('seconds');
            //跳转等待时间累减
            document.getElementById('seconds').innerHTML = --secs;
            //判断是否进行页面跳转或等待1s继续执行此方法
            if(secs >= 0){
                setTimeout('timing(' + secs + ',\'' + url + '\')', 1000);
            }else{
                location.href = url;
            }
        }
        //执行此函数
        timing(3, '\.\.\/'+ '章节目录'  + '\/' + '第六章.html');
        //使用setInterval()函数也能实现
        // var seconds = document.getElementById('seconds').innerHTML;
        // var id = setInterval(() => {
        //     document.getElementById('seconds').innerHTML = --seconds;
        //     if(seconds < 0){
        //         location.href = '限时秒杀.html';
        //     }
        // }, 1000);
    </script>
</body>
</html>